<%@ page language="java" contentType="text/html;charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<script src="<c:url value='/js/jquery.form.js'/>"></script>
<script type="text/javascript">
$(document).ready(function() {
    var options = {
        success : function(data) {
            $("#working-area").html(data);
            alert("保存成功！");
        }
    };
    $("#select-method-component-form").ajaxForm(options);
});
</script>


<c:choose>
	<c:when test="${!empty project }">
		<div class="page-header">
			<h3 style="margin-top: auto">
				<c:out value="${project.name}"></c:out>
			</h3>
			 <a type="btn" class="btn" href="/ManEnv/project/${project.id}/generateCode">
                            <i class="icon-ok"></i>&nbsp;下载代码
             </a>
		</div>
		
		<div class="span9">
            <h4>勾选需要下载的功能函数组件</h4>
            <table class="table table-hover table-striped table-bordered">
                <thead>
                    <tr>
                        <tr>
                            <th width="10%">编号</th>
                            <th width="30%">名称</th>
                            <th width="30%">实现接口</th>
                            <th width="20">类型</th>
                            <th width="10%">版本号</th>
                        </tr>
                    </tr>
                </thead>
				<tbody>
					<form class="form-horizontal" id="select-method-component-form"
						action="/ManEnv/projectMethod/${project.id}/add" method="post">
						<c:forEach items="${projectMethodTuples}" var="tuple"
							varStatus="status">
							<tr>
								<td>
								<c:choose>
								    <c:when test="${!empty tuple.second.project}">
								        <label class="checkbox">
								            <input type="checkbox"
                                            name="methodComponentIds" value="${tuple.first.id}" checked></label>
                                    </c:when>
                                    <c:otherwise>
                                        <label class="checkbox">
                                            <input type="checkbox" name="methodComponentIds" value="${tuple.first.id}">
                                        </label>
                                    </c:otherwise>
                                </c:choose>
                                </td>
								<td><c:out value="${tuple.first.name}" /></td>
								<td><c:choose>
										<c:when test="${!empty tuple.first.cinterface}">
											<c:out value="${tuple.first.cinterface.name}" />
										</c:when>
									</c:choose></td>
								<td><c:choose>
                                        <c:when test="${!empty tuple.first.cinterface}">
                                            <c:out value="${tuple.first.cinterface.itype}" />
                                        </c:when>
                                    </c:choose></td>
								<td><c:out value="${tuple.first.version}" /></td>
						</c:forEach>
						<div class="control-group">
							<div class="controls">
								<button type="submit" class="btn">
									<i class="icon-ok"></i> 保存
								</button>
							</div>
						</div>
					</form>
				</tbody>
			</table>
        </div>
		
	</c:when>
</c:choose>




<script src="<c:url value='/js/project.js'/>"></script>


